package com.oo.app.ui.main.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.oo.app.R;
import com.oo.app.base.activities.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by 赵聪 on 2018/7/27.
 * 我的页面
 */

public class MyPageActivity extends BaseActivity implements View.OnClickListener{

    @BindView(R.id.iv_portrait)
    CircleImageView ivPortrait;

    @BindView(R.id.tv_username)
    TextView tv_username;

    @BindView(R.id.iv_vip)
    ImageView iv_vip;

    @BindView(R.id.iv_user_sex)
    ImageView iv_user_sex;

    @BindView(R.id.tv_user_age)
    TextView tv_user_age;

    @BindView(R.id.tv_user_id)
    TextView tv_user_id;

    @BindView(R.id.tv_my_earnings)
    TextView tv_my_earnings;

    @BindView(R.id.tv_my_egg_coin_boy)
    TextView tv_my_egg_coin_boy;

    @BindView(R.id.view_egg_coin_girl_line)
    View view_egg_coin_girl_line;

    @BindView(R.id.tv_my_egg_coin_girl)
    TextView tv_my_egg_coin_girl;

    @Override
    protected int getContentView() {
        return R.layout.activity_mypage;
    }

    @Override
    protected void initWidget() {
        super.initWidget();
        initsex(1);
    }

    @Override
    protected void initData() {
        super.initData();
    }

    public static void show(Context context) {
        Intent intent = new Intent(context, MyPageActivity.class);
        context.startActivity(intent);
    }

    @OnClick({R.id.iv_me_close,R.id.tv_my_earnings,R.id.tv_my_egg_coin_boy,R.id.tv_my_vip,R.id.tv_invitation_make_money,R.id.tv_my_egg_coin_girl,R.id.tv_my_customer_service,R.id.tv_setting})
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_me_close:
                finish();
                break;
            case R.id.tv_my_earnings://我的收益
                MyEarningsActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_my_egg_coin_boy://我的蛋币
                MyEggCoinActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_my_vip: //我的vip
                MyVIPActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_invitation_make_money://邀请赚钱
                InvitingMakeMoneyActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_my_egg_coin_girl://我的蛋币
                MyEggCoinActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_my_customer_service://我的客服
                CustomerServiceActivity.show(MyPageActivity.this);
                break;
            case R.id.tv_setting: //设置
                SettingActivity.show(MyPageActivity.this);
                break;
        }
    }

    private void initsex(int sex){ //性别区分显示
        if (sex == 0){ //男0  女1
            tv_my_earnings.setVisibility(View.GONE);
            view_egg_coin_girl_line.setVisibility(View.GONE);
            tv_my_egg_coin_girl.setVisibility(View.GONE);

            tv_my_egg_coin_boy.setVisibility(View.VISIBLE);
//            iv_user_sex.setBackgroundResource(R.mipmap.me_icon_male);
        }else {
            tv_my_earnings.setVisibility(View.VISIBLE);
            view_egg_coin_girl_line.setVisibility(View.VISIBLE);
            tv_my_egg_coin_girl.setVisibility(View.VISIBLE);

            tv_my_egg_coin_boy.setVisibility(View.GONE);
//            iv_user_sex.setBackgroundResource(R.mipmap.me_icon_female);
        }
    }

}
